/**
 * 
 */
package com.sidom.movieIndexer.factory;

import com.sidom.movieIndexer.domain.file.MovieFile;
import com.sidom.movieIndexer.domain.google.GoogleSearchResult;
import com.sidom.movieIndexer.domain.google.Match;

/**
 * Factory class for creating {@link MovieFile}s.
 * 
 * @author Siebe
 */
public class GoogleSearchResultFactory {
	public enum TestGoogleSearchResult {
		BOURNE_IDENTITY, 
		GONE_IN_60_SECONDS,
		THE_MATRIX,
		THE_ISLAND,
		THE_ITALIAN_JOB,
		NO_MOVIE_WITH_THIS_NAME,
		TRANSPORTER,
		EQUILIBRIUM,
		SWORDFISH,
		YOUTUBE,
		BOX_OFFICE,
		THE_MTRX;
	}
	
	/**
	 * Create a {@link GoogleSearchResult}.
	 * @return The {@link GoogleSearchResult}
	 */
	public static GoogleSearchResult createGoogleSearchResult(){
		return new GoogleSearchResult(null);
	}
	
	/**
	 * Create a {@link GoogleSearchResult}.
	 * @return The {@link GoogleSearchResult} with null {@link Response} from Google.
	 */
	public static GoogleSearchResult createGoogleSearchResult(String imdbUrl){
		GoogleSearchResult googleSearchResult = createGoogleSearchResult();
		googleSearchResult.setImdbUrl(imdbUrl);
		return googleSearchResult;
	}
	
	/**
	 * Create a {@link GoogleSearchResult}.
	 * @return The {@link GoogleSearchResult} with null {@link Response} from Google.
	 */
	public static GoogleSearchResult createGoogleSearchResult(String imdbUrl, Match match){
		GoogleSearchResult googleSearchResult = createGoogleSearchResult();
		googleSearchResult.setImdbUrl(imdbUrl);
		googleSearchResult.setMatch(match);
		return googleSearchResult;
	}
	
	/**
	 * Create a test {@link GoogleSearchResult}.
	 * @param testGoogleSearchResult The {@link TestGoogleSearchResult}
	 * @return The {@link GoogleSearchResult} with null {@link Response} from Google.
	 */
	public static GoogleSearchResult createGoogleSearchResult(TestGoogleSearchResult testGoogleSearchResult){
		switch (testGoogleSearchResult) {
			case BOURNE_IDENTITY:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0258463/", Match.PERFECT_MATCH);
			case GONE_IN_60_SECONDS:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0187078/", Match.PERFECT_MATCH);
			case THE_MATRIX:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0133093/", Match.PERFECT_MATCH);
			case THE_ISLAND:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0399201/", Match.PERFECT_MATCH);
			case THE_ITALIAN_JOB:
				return createGoogleSearchResult(null, Match.NOT_FOUND);
			case NO_MOVIE_WITH_THIS_NAME:
				return createGoogleSearchResult(null, Match.NOT_FOUND);
			case TRANSPORTER:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0293662/", Match.PERFECT_MATCH);
			case EQUILIBRIUM:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0238380/", Match.PERFECT_MATCH);
			case SWORDFISH:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0244244/", Match.PERFECT_MATCH);
			case YOUTUBE:
				return createGoogleSearchResult("http://www.imdb.com/title/tt1234506/", Match.MATCH);
			case BOX_OFFICE:
				return createGoogleSearchResult("http://us.imdb.com/title/tt1125849/business", Match.MATCH);
			case THE_MTRX:
				return createGoogleSearchResult("http://www.imdb.com/title/tt0133093/", Match.PERFECT_MATCH);
			default:
				return createGoogleSearchResult();
		}
	}
}
